package com.itcodai.service.message;

import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.jms.Destination;

/**
 * 消息发送者
 * @author c-fanqj
 * @date 2023/4/18
 * @apiNote
 */
@Service
public class MsgProducerService {

    @Resource
    private JmsMessagingTemplate jmsMessagingTemplate;

    // destination:消息发送的目的地  msg:具体的消息内容
    public void sendMessage(Destination destination, String msg) {
        jmsMessagingTemplate.convertAndSend(destination, msg);
    }

}
